import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/seller',
    name: 'Seller',
    component: () => import('../views/Seller.vue'),
    children:[
      {
        path: '/seller/dingdan',
        name: 'Dingdan',
        component: () => import('../components/SellerComponents/dingdan.vue'),
      },
      {
        path: '/seller/shangpin',
        name: 'Shangping',
        component: () => import('../components/SellerComponents/shangpin.vue'),
      },
      {
        path:'/',
        redirect:'/seller/dingdan'
      }
  ]
  },
  {
    path: '/userManager',
    name: 'UserManager',
    component: () => import('../views/UserManager.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../components/Login.vue')
  },
  {
    path: '/MoreGoods',
    name: 'Goods',
    component: () => import('../views/MoreGoods.vue'),
    children:[
        {
          path: '/MoreGoods/new',
          name: 'new',
          component: () => import('../components/GoodsComponents/new.vue'),
        },
        {
          path: '/MoreGoods/hot',
          name: 'hot',
          component: () => import('../components/GoodsComponents/hot.vue'),
        },
    ]
  },
  {
    path: '/goodDetil',
    name:'GoodDetil',
    component: () => import('../components/HomeComponents/goodDetil.vue'),
  },
  {
    path: '*',
    redirect:'/home'
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
